package cn.com.aiton.common.utils;

import cn.com.aiton.common.constant.Gbt209992007;
import cn.com.aiton.common.utils.ByteUtils;

import java.util.Calendar;
import java.util.GregorianCalendar;

public class AitonExtendTimeUtils {
    /**
     * 校时功能
     *  与本机的时间为准，返回的校时指令。对某台信号机进行校时
     * @param
     * @return
     */
    public static byte[] timing() {
            byte[] hex = Gbt209992007.SET_TIMING;
            Calendar cal = GregorianCalendar.getInstance();
            Long time = cal.getTimeInMillis();
            int timeInt =(int)(time/1000);
            byte[] bytes = ByteUtils.intToByte(timeInt);
            hex[3] = bytes[3];
            hex[4] = bytes[2];
            hex[5] = bytes[1];
            hex[6] = bytes[0];

        return hex;
    }
}
